<template>
  <div>
    <div class="seed_top_banner">
      <div class="seed_back_arrow" @click="back">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-zuo"></use>
        </svg>
      </div>
      <div class="seed_page_title"><span>小程序设置</span></div>
      <div class="seed_page_tool"></div>
    </div>
    <!--列表-->
    <div class="seed_my_set_mysecond">
      <div class="seed_my_set_list" v-for="(item, index) in tem_list" v-bind:key="index" style="border-bottom: solid 0.01rem #f7f7f7">
        <p>{{item.title}}</p>
        <div class="seed_my_set_jt">
          <mt-switch v-model="item.checked" @change="turn(index)"></mt-switch>
        </div>
      </div>
      <!--<div class="seed_my_set_list">-->
        <!--<p>支付成功提醒</p>-->
        <!--<div class="seed_my_set_jt">-->
          <!--<mt-switch v-model="value_two" @change="turn"></mt-switch>-->
        <!--</div>-->
      <!--</div>-->
      <!--<div class="seed_my_set_list">-->
        <!--<p>发货提醒</p>-->
        <!--<div class="seed_my_set_jt">-->
          <!--<mt-switch v-model="value_three" @change="turn"></mt-switch>-->
        <!--</div>-->
      <!--</div>-->
      <!--<div class="seed_my_set_line"></div>-->
      <!--<router-link :to="{name:'my-setpwd'}">-->
        <!--<div class="seed_my_set_list">-->
            <!--<p>修改密码</p>-->
            <!--<img src="../../assets/images/jt.png" class="seed_my_set_jt" style="width: 0.5rem">-->
        <!--</div>-->
      <!--</router-link>-->
      <!--<div class="seed_my_set_line"></div>-->
      <!--<div class="seed_my_set_list">-->
        <!--<p>当前版本</p>-->
        <!--&lt;!&ndash;<img src="../../assets/images/jt.png" class="seed_my_set_jt" style="width: 0.5rem">&ndash;&gt;-->
        <!--<span class="seed_my_set_jt" style="width: auto">V1.0.0</span>-->
      <!--</div>-->
    </div>
    <!--<div class="seed_my_set_logout" @click="logout">退出登录</div>-->
  </div>
</template>
<script>
export default {
  data () {
    return {
      app_id: 0,
      tem_list: []
    }
  },
  created () {
    this.app_id = this.$route.params.id
    this.getTemList()
  },
  methods: {
    back () {
      this.$router.push({name: 'my-mini_app_set'})
    },
    turn (index) {
      let select = this.tem_list[index]
      let status = 1
      if (select.checked === false) {
        status = 0
      }
      let param = {
        appid: this.app_id,
        status: status,
        msg_id: select.msg_id,
        template_id: select.template_id
      }
      this.$request.SaveTemSet(param).then()
    },
    getTemList () {
      this.$request.getTemList({app_id: this.app_id}).then(data => {
        this.tem_list = data
      })
    },
    logout () {
      this.$MessageBox.confirm('确定要退出登录吗?').then(action => {
        this.$request.logout().then(data => {
          this.$utils.setCookie('token', '', -1)
          this.$toast('已退出登录')
          this.$router.push({name: 'passport-login'})
        })
      })
    }
  }
}
</script>
